﻿//namespace Brjnk.GpxExplorer.ViewModel
//{
//    using System;
//    using System.ComponentModel;
//    using Brjnk.Common;

//    public class ObjectVM<T> : INotifyPropertyChanged, IWrapper<T> where T : INotifyPropertyChanged
//    {
//        private bool canHide;

//        public ObjectVM(T source, bool canHide = false)
//        {
//            this.source = source;
//            this.canHide = canHide;
//            source.PropertyChanged+=SourcePropertyChanged;
//        }

//        private T source;

//        public T Source { get { return source; } }

//        private bool isSelected;

//        public bool IsSelected
//        {
//            get { return isSelected; }
//            set { isSelected = value; OnPropertyChanged("IsSelected"); }
//        }

//        private bool visible = true;

//        public bool Visible
//        {
//            get { return visible; }
//            set
//            {
//                if (visible == false && canHide == false) throw new InvalidOperationException("Objekt nelze skrýt!");
//                visible = value; OnPropertyChanged("Visible");
//            }
//        }

//        public event PropertyChangedEventHandler PropertyChanged;

//        protected void OnPropertyChanged(string propertyName)
//        {
//            if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
//        }

//        protected virtual void SourcePropertyChanged(object sender, PropertyChangedEventArgs e)
//        {
//        }

//        public T GetWrappedObject()
//        {
//            return source;
//        }
//    }
//}